package top.infopub.mgr.hyp.web;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import top.infopub.generic.GenericController;


/**
 * 会员用户管理
 * @author Awoke
 * @version 2018年10月15日
 * @see HyOperatorController
 * @since
 */
@Controller
@RequestMapping("/hyOperator")
public class HyOperatorController extends GenericController {

    /*@Autowired
    private BaseInfoService baseInfoService;
    
    @Autowired
    private RedisPubCache redisPubCache;

    *//**
     * 用户管理列表
     * @return
     *//*
    @RequestMapping("/list")
    public String list() {
        return "hyp/hy-oprator-list";
    }

    *//**
     * 根据用户ID获取用户
     * @param id
     * @return
     *//*
    @RequestMapping("/getOperatorById")
    public @ResponseBody ResponseVo<BaseInfo> getOperatorById(String id) {
        BaseInfo operator = baseInfoService.selectByPrimaryKey(id);
        if (operator == null) {
            operator = new BaseInfoVo();
        }
        return ResponseVo.getSuccessResponse(operator);
    }

    *//**
     * 用户管理列表数据
     * @return
     *//*
    @RequestMapping("/queryData")
    @ResponseBody
    public ResponseVo<BaseInfo> queryData(BaseInfo baseInfo, ParamPage paramPage) {
        Page<BaseInfo> page = new Page<BaseInfo>();
        page.setPageNum(paramPage.getPage());
        page.setPageSize(paramPage.getLimit());
        page = baseInfoService.selectPageByDomainWhere(page, baseInfo);
        return ResponseVo.getSuccessResponse(page.getTotal(), page.getResult());
    }

    *//**
     * 修改用户状态
     * @param operatorVo
     * @return 
     * @see
     *//*
    @RequestMapping("/updateStatus")
    public @ResponseBody ResponseVo<String> updateStatus(BaseInfoVo baseInfoVo) {
        BaseInfo baseInfo = baseInfoService.selectByPrimaryKey(baseInfoVo.getId());
        Integer oldStatus = baseInfo.getIstatus();
        Integer newStatus = 0;
        if(oldStatus == 0){
            newStatus = -1;
        }else{
            newStatus = 0;
        }
        baseInfo.setIstatus(newStatus);
        baseInfo.setTupdateTime(new Date());
        baseInfoService.updateBySelective(baseInfo);
        //停用账户时，用户账户退出前台登录状态，删除token和uid
        if(newStatus == -1){
            redisPubCache.deleteTokenAndUid(baseInfo.getId());
        }
        return ResponseVo.getSuccessResponse();
    }

    *//**
     * 修改用户密码
     * @return
     *//*
    @SuppressWarnings("unchecked")
    @RequestMapping("/change-password")
    public @ResponseBody ResponseVo<String> changePwd(String cid, String pasword, String pasword1) {
        if (StringUtils.isEmpty(cid) || StringUtils.isEmpty(pasword)
            || StringUtils.isEmpty(pasword1)) {
            return ErrorCodeEnum.ERROR_COMMON_SAVE.getResponseVo(Constants.BAD_PARAMETERS_REQUEST);
        }
        //检验新密码格式是否正确
        if(!ValidateUtils.isValidPassword(pasword)){
            return ErrorCodeEnum.ERROR_COMMON_SAVE.getResponseVo("请输入正确格式的密码");
        }
        //验证两次输入的密码是否一致
        if (!pasword.equals(pasword1)) {
            return ErrorCodeEnum.ERROR_COMMON_SAVE.getResponseVo(Constants.CHANGE_PWD_NEWS_NOT_EQUALS);
        }
        BaseInfo operator = baseInfoService.selectByPrimaryKey(cid);
        //operator.setTupdateTime(new Date());
        // MD加盐
        //operator.setSpassword(MD5.salt(operator.getId(), pasword));
        baseInfoService.updateBySelective(operator);
        // 操作日志
        LogUtil.bizLog(LogUtil.LogModelType.MEMBER, LogUtil.AcctionType.UPDATE,
            "修改登录密码  姓名:" + operator.getSuserName(), "");
        return ResponseVo.getSuccessResponse();
    }*/

}
